#include <stdio.h>
#include "c_stack.h"

struct node_data{
    int _data;
};

int main()
{
    Stack* stk = ConstructStack(StackType::ArrayStack);

    printf("stack sizeof:%lu\n",sizeof(Stack));

    for(int i=0;i<10;++i)
    {
        node_data* pData = (node_data*)malloc(sizeof(node_data));
        pData->_data = i;
        Push(stk,(void*)pData);
    }

    printf("stack length:%u\n",Length(stk));
    
    while(!Empty(stk))
    {
        void* data = Top(stk);
        Pop(stk);
        printf("%d\n",((node_data*)data)->_data);
        free(data);
        data = NULL;
    }

    Clear(stk);
    
    printf("stack length:%u\n",Length(stk));

    DestructStack(stk);
    return 0;
}